package com.data.center.service.mongo;
import com.data.center.entity.mongo.MongoPaper;
import com.data.center.mapper.mongo.MongoPaperRepository ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class MongoPaperService {
    @Autowired
    private MongoPaperRepository paperRepository;

    public List<MongoPaper> getAllPapers() {
        return paperRepository.findAll();
    }

    public Optional<MongoPaper> getPaperById(String paperId) {
        return paperRepository.findByPaperId(paperId);
    }

    public MongoPaper savePaper(MongoPaper paper) {
        return paperRepository.save(paper);
    }


}
